const mongoose = require("./db");

// 创建集合之前，先创建集合字段的约束对象
const userSchema = new mongoose.Schema({
    userId:  {type: String},
    username: {type: String},
    password: {type: String},
    tel:  {type: String},
    age:  {type: Number},
    sex:  {type: String},
    power:  {type: Number},
    token:  {type: String},
    lastLoginTime: {type: Number},
    regTime: {type: Number},
    avatar: {type: String},
    job: {type: String}
})
// 暴露集合对象，以备在当前集合上对数据进行增删改查
module.exports = mongoose.model("user", userSchema);

